<?php

class VideoModule extends fvModule {

    function __construct () {
        $moduleName = strtolower(substr(__CLASS__, 0, -6));

        parent::__construct(fvSite::$fvConfig->get("modules.{$moduleName}.smarty.template"), 
                            fvSite::$fvConfig->get("modules.{$moduleName}.smarty.compile"), 
                            fvSite::$Layoult);
    }

    function showIndex() {
        $pager = new fvPager(VideoManager::getInstance());
        $this->__assign('Videos', $pager->paginate(null, 'id DESC'));
        return $this->__display('video_list.tpl');    
    }

    function showEdit() {
        $request = fvRequest::getInstance();
        if (!$Video = VideoManager::getInstance()->getByPk($request->getRequestParameter('id'))) {
            $Video = new Video();
        }
        $this->__assign(array(
            'Video' => $Video,
        ));
        return $this->__display('video_edit.tpl');
    }
    
}

?>
